<html >
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link  href="CSS/login.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<div id="center">

    <form  action="">

        <h1 style="text-align: center;color:rgba(56, 55, 52, 0.788)">登录</h1><br>

        <hr><br>
        <p>账号<input type="text" placeholder="请输入密码" id="email"/></p>

        <p>密码<input type="password" placeholder="密码长度至少为六位" id="passworld"/></p>

        <div style="text-align: center;margin-top: 30px;">

            <input type="submit" class="button"  οnclick=" submit()"  value="登录">

            <input type="reset" class="button" οnclick="jumpRe()" value="注册"><br><br><br>

            <a href="#" id="a"  style="text-align:center;">忘记密码？</a>

        </div>

    </form>

</div>

<script language="javascript" type="text/javascript">



    function jumpRe(){

        window.location.href="re.html";

    }

    document.getElementById("a").onclick = function click(){

        window.location.href="register.jsp";

    }



    //判断邮箱格式

    email.onchange = function(){

        var email = this.value;

        var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;

        if(reg.test(email)){

            alert("邮箱格式正确");

        }else{

            alert("邮箱格式不正确");

        }

    }



    //判断密码格式

    passworld.onchange = function(){

        var passwolrd = this.value;

        var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/;

        if(reg.test(passworld)){

        }else{

            alert("密码格式不正确");

        }

    }



    function submit() {

        var pwd1 = document.getElementById("passworld").value;

        var e = document.getElementById("email").value;

        var pwd2=localStorage.getItem("password");

        var e2=localStorage.getItem("email");

        if(pwd1==pwd2&&e==e2)

            window.location.href="#.html";

        else

            alert("账号或密码不正确");

    }

</script>

</body>

</html>

